// 抽离组建计算的通用逻辑，方便导入到每个页面中
import store from "../store";
import {mapActions, mapState} from "vuex";
import appConfig from "../../api/appConfig";

export default {
    computed: {
        ...mapState('app', ['device', 'winSize', 'uniLeftMenuState'])
    },
    methods:{
        judge(mode){
            // 判断几种比较常见的模式
            if (mode === appConfig.calMode.desktop){
                return this.device === appConfig.deviceType.desktop
            }else if(mode === appConfig.calMode.mobile){
                return this.device === appConfig.deviceType.mobile
            }else if(mode === appConfig.calMode.mobileNoLeft){
                return (this.device === appConfig.deviceType.mobile) &&
                    (this.uniLeftMenuState.matchLeftWindow === false)
            }else if(mode === appConfig.calMode.mobileLeft){
                return (this.device === appConfig.deviceType.mobile) &&
                    (this.uniLeftMenuState.matchLeftWindow === true)
            }else{
                return false
            }
        }
    }
}
